package com.rowline.admin.module.web.controller;

import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestMethod;
import org.springframework.web.bind.annotation.RequestParam;
import org.springframework.web.servlet.ModelAndView;

import javax.servlet.http.HttpServletRequest;

/**
 * ClassName:LoginController
 * Created by 245167
 * on 2017/8/14  14:33
 * description:登录
 */
@Controller
@RequestMapping("/login")
public class LoginController {

    @RequestMapping(value = "/doLogin", method = RequestMethod.POST)
    public ModelAndView toLogin(@RequestParam("loginUsername")String username,
                                @RequestParam("loginPassword")String password,
                                HttpServletRequest httpServletRequest){

        ModelAndView moide =  new ModelAndView();
        try{
            System.out.println("账号：" + username);
            System.out.println("密码：" + password);
            moide.setViewName("main");
            moide.addObject("message","Hell word!!");
        }catch (Exception e){
            moide.setViewName("fail");
        }
        return moide;
    }
}
